From: Giuseppe Scrivano Date: Fri, 16 Jan 2015 18:21:27 +0000 (+0100) Subject: static-delta: limit the number of writes in process to 1 X-Git-Tag: archive/raspbian/2022.1-3+rpi1~1^2~973 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=4991e9ab6a2adefa78a08b4582b62b2b093a319c;p=ostree.git static-delta: limit the number of writes in process to 1 This will avoid too many open files at the same time that could cause an EMFILE error. Signed-off-by: Giuseppe Scrivano (cherry picked from commit bc092b06f0e34e93f7d6102957bf55fd7ffd1b9e) --- diff --git a/src/libostree/ostree-repo-static-delta-processing.c b/src/libostree/ostree-repo-static-delta-processing.c index 13abc6c0..a663b84c 100644 --- a/src/libostree/ostree-repo-static-delta-processing.c +++ b/src/libostree/ostree-repo-static-delta-processing.c @@ -265,6 +265,11 @@ _ostree_static_delta_part_execute_raw (OstreeRepo *repo, guint8 opcode; OstreeStaticDeltaOperation *op; + /* Limit the number of outstanding writes to 1 to prevent too many open files + at the same time. */ + while (state->outstanding_content_writes > 1) + g_main_context_iteration (state->content_writing_context, TRUE); + if (state->object_start) { if (!open_output_target (state, cancellable, error))